#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "canthread.h"

#ifdef __cplusplus

extern "C"{
    #include "canid_List.h"


#endif

#ifdef __cplusplus
}
#endif


QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void AddDataToList(QStringList strList);
    void ProtocolProcess(VCI_CAN_OBJ *vci);
    void sendPacketInfo(unsigned int packet_size,unsigned int flash_offset);
    void sendPacket(uint8_t* packet_data,unsigned int packet_size);
    void updatechart(BYTE dlc,unsigned char* data,UINT CANid);
private slots:
    void onGetProtocolData(VCI_CAN_OBJ *vci,unsigned int dwRel,unsigned int channel);
    void onBoardInfo(VCI_BOARD_INFO vbi);

    void on_pushButton_opendevice_clicked();

    void on_pushButton_InitCAN_clicked();

    void on_pushButton_StartCAN_clicked();

    void on_pushButton_reset_clicked();

    void on_pushButton_sendMsg_clicked();

    void on_pushButton_ClearRecv_clicked();

    void on_pushButton_ScanNode_clicked();

    void on_pushButton_OpenFile_clicked();

    void on_pushButton_UpdateFirmware_clicked();

    void on_comboBox_CANChannel_currentIndexChanged(int index);

    void on_comboBox_CANChannelofFunction_currentIndexChanged(int index);

    void on_pushButton_Execute_clicked();

signals:
    void EcuReWriteInfoSuccess(void);
    void EcuReWriteSuccess(void);
    void EcuReFailed(void);

private:
    Ui::MainWindow *ui;
    CANThread *canthread;
};
#endif // MAINWINDOW_H
